from django.conf.urls.defaults import *
from django.conf import settings
from settings import cur_path
import os

from django.contrib import admin
admin.autodiscover()

urlpatterns = []

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.abspath(cur_path+'/../../media/')}),
        (r'^js/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.abspath(cur_path+'/../../media/js/')}),
        (r'^css/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.abspath(cur_path+'/../../media/css/')}),
        (r'^i/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.abspath(cur_path+'/../../media/i/')}),
    )

urlpatterns += patterns('enbook.games.views',
    (r'^', include('enbook.games.urls')),
    url(r'^search', 'search', name='search'),
    (r'^admin/(.*)', admin.site.root),
)
